﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TheOutfield.UmbExt.UniversalMediaPicker.Extensions
{
    public static class MediaItemExtensions
    {
        public static BasicMediaItem ToBasicMediaItem(this MediaItem mi)
        {
            var bmi = new BasicMediaItem
            {
                Id = mi.Id,
                Title = mi.Title,
                PreviewImageUrl = mi.PreviewImageUrl
            };

            foreach (var key in mi.MetaData.Keys)
            {
                bmi.MetaData.Add(key, mi.MetaData[key]);
            }

            return bmi;
        }
    }
}